home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 3233 < prev    next >
Encoding:
Text File  |  1996-08-06  |  2.8 KB  |  72 lines

  1. Path: news.cc.uic.edu!sunphy1!olczyk
  2. From: olczyk@sunphy1 (Lambert Schoonveld)
  3. Newsgroups: comp.lang.c++,comp.lang.pascal.delphi.misc
  4. Subject: Re: C++ with Zapp vs. Delphi
  5. Followup-To: comp.lang.c++,comp.lang.pascal.delphi.misc
  6. Date: 22 Jan 1996 23:07:12 GMT
  7. Organization: University of Illinois at Chicago
  8. Message-ID: <4e15b0$1g68@tigger.cc.uic.edu>
  9. References: <4coar6$d4n@sun4.bham.ac.uk> <4coip7$69s@news1.usa.pipeline.com> <DBk8wg2yqjbB083yn@iaccess.za> <4d7pmb$48c8@tigger.cc.uic.edu> <4dk38h$gdr@merlin.delphi.com> <4dksp1$3d6c@tigger.cc.uic.edu> <30fe666e.3349285@130.15.126.54> <4durk2$2r54@tigger.cc.uic.edu> <31038877.2364473@130.15.126.54>
  10. NNTP-Posting-Host: sunphy1.phy.uic.edu
  11. X-Newsreader: TIN [version 1.2 PL2]
  12.  
  13. Duncan Murdoch (dmurdoch@mast.queensu.ca) wrote:
  14. : olczyk@sunphy1 (Constantin Rasinariu) wrote:
  15.  
  16. : >Duncan Murdoch (dmurdoch@mast.queensu.ca) wrote:
  17.  
  18. : >: There's not a big difference, but I think this is a little bit
  19. : >: preferable.  It makes it clear that it's up to the list to know about
  20. : >: sorting, not up to the object.  That way you can easily put the same
  21. : >: object in multiple lists with different sorting rules.
  22. : >Try
  23. : >class A:SortedObject (CompareTo not overridden)
  24. : >class B: A ( override with first comparison )
  25. : >class C: A  (override second comparison )
  26.  
  27. : This won't work.  Each object will still have some class, be it B or
  28. : C.  It'll end up sorted on one comparison or the other.  What I want
  29. : is to have two lists (say AlphaList and NumericList) and put
  30. : references to the same object in both lists.  The first would end up
  31. : sorted alphabetically, the second numerically.
  32.  
  33. class A:SortedObject
  34. {
  35.   ....
  36. public:
  37.   A *a;
  38.   A()
  39.   { ...
  40.   a=0;
  41.   }
  42. };
  43.  
  44.  
  45.  
  46. The CompareTo's have to test a for 'nillness', but should work accordingly.
  47.  
  48. In your method what if the comparison needs to use private data in the object?
  49.  
  50.  
  51. : >OK. Try this one.
  52. : >You have a class, call it model which contains data and a list
  53. : >of objects that derive from a 'view' class. Each  'view' class must
  54. : >derive from a component. Each view class must received new data as it is 
  55. : >modified in model. Model must recieve data from the view class as it
  56. : >is changed in the view.
  57. : >How do you implement this?
  58.  
  59. : I'm sorry, but I'm not sure what you're asking.  Can you state the
  60. : problem in more generic terms, without assuming your solution?
  61. : Remember, I'm reading this in the Delphi group, and I'm not
  62. : particularly familiar with C++ jargon.
  63.  
  64. Strange since it's basis is in Smalltalk.
  65. You have a class called model. It's purpose is to hlod data of some
  66. form ( say a record in a database). You have a set of classes
  67. called 'views' (say dataaware components). When you create a view
  68. it is associated to a model object. When the data stored in the model object
  69. changes, it updates the views. When a view changes it updates the model.
  70. ---------------------------
  71. Thaddeus L. Olczyk
  72.